package com.iyang.bootadmin.controller;

import com.iyang.bootadmin.pojo.Menu;
import com.iyang.bootadmin.serivcie.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;
import java.util.Map;

/**
 * 视图跳转的页面
 * @Author: Mu_YI
 * @Date: 2019/3/9 0:08
 * @Version 1.0
 */
@Controller
@RequestMapping("/api/v1/view")
public class ViewController {

    @Autowired
    public UserService userService;

    @RequestMapping("login")
    public String toLogin(){
        return "login";
    }

    @RequestMapping("welcome")
    public String toWelcome(){
        return "welcome";
    }

    @RequestMapping("index")
    public String index(Model model){
        Map<String,Object> resultMap = userService.menuAll();
        System.out.println(resultMap);
        model.addAttribute("menuList",resultMap.get("entris"));
        return "index";
    }

}
